//
//  UIScrollView+touch.m
//  NaRiLSVMT
//
//  Created by zhangmeng on 14/11/25.
//  Copyright (c) 2014年 helloyouth.org. All rights reserved.
//

#import "UIScrollView+touch.h"

@implementation UIScrollView (touch)
//- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
//{
//    // init the bezier path
//    //if(self.colseEvent){
////    self.colseEvent = NO;
////    TcpClient *tcp = [TcpClient sharedInstance];
////    dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
////        for(NSString *host in self.hostIdarr){
////            [tcp writeString:[Common closeEvent:[host intValue] Metuod:@"CloseShowWindow"]];
////        }
////    });
////    //}
////    if(self.dropListView.isOpen){
////        [self.dropListView hideExtendedChooseView];
////    }
////    else{
////        //  [self updateCacheImage:NO];
////        if (self.drawingMode == DrawingModePainting){
////            self.currentTool = [self toolWithCurrentSettings];
////            self.currentTool.lineWidth = self.lineWidth;
////            self.currentTool.lineColor = self.lineColor;
////            self.currentTool.lineAlpha = self.lineAlpha;
////            [self.pathArray addObject:self.currentTool];
////            
////            // add the first touch
////            UITouch *touch = [touches anyObject];
////            currentLocation  = [touch locationInView:self];
////            [self.currentTool setInitialPoint:[touch locationInView:self]];
////            // call the delegate
////            if ([self.delegate respondsToSelector:@selector(drawingView:willBeginDrawUsingTool:)]) {
////                [self.delegate drawingView:self willBeginDrawUsingTool:self.currentTool];
////            }
////            if (self.drawingMode == DrawingModePainting){
////                TcpClient *tcp = [TcpClient sharedInstance];
////                dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
////                    for(NSString *host in self.hostIdarr){
////                        [tcp writeString:[Common tcpDrawXYstring:[host intValue] Metuod:@"DeviceStartDraw" X:(currentLocation.x)*self.zoomX Y:(currentLocation.y)*self.zoomY]];
////                    }
////                });
////            }
////            
////            
////            
////            
////        }
////    }
//}
//
//- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
//{
//    UITouch *touch = [touches anyObject];
//    CGPoint currentLocation = [touch locationInView:self];
////    previousLocation = [touch previousLocationInView:self];
////    
////    if (self.drawingMode == DrawingModeNoneing) {
////        
////        // do nothing
////    }
////    else if (self.drawingMode == DrawingModePainting) {
////        [self.currentTool moveFromPoint:previousLocation toPoint:currentLocation];
////#if PARTIAL_REDRAW
////        // calculate the dirty rect
////        CGFloat minX = fmin(previousLocation.x, currentLocation.x) - self.lineWidth * 0.5;
////        CGFloat minY = fmin(previousLocation.y, currentLocation.y) - self.lineWidth * 0.5;
////        CGFloat maxX = fmax(previousLocation.x, currentLocation.x) + self.lineWidth * 0.5;
////        CGFloat maxY = fmax(previousLocation.y, currentLocation.y) + self.lineWidth * 0.5;
////        [self setNeedsDisplayInRect:CGRectMake(minX, minY, (maxX - minX), (maxY - minY))];
////#else
////        [self setNeedsDisplay];
////#endif
////        TcpClient *tcp = [TcpClient sharedInstance];
////        dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
////            for(NSString *host in self.hostIdarr){
////                [tcp writeString:[Common tcpDrawXYstring:[host intValue] Metuod:@"DeviceDoingDraw" X:(currentLocation.x)*self.zoomX Y:(currentLocation.y)*self.zoomY]];
////
//                NSLog(@"currentLocation x = %f",currentLocation.x);
//                NSLog(@"currentLocation y = %f",currentLocation.y);
////            }
////        });
////    }
////    else
////    {
////        
////    }
//}
//
//- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
//{
//    // make sure a point is recorded
//    // [self touchesMoved:touches withEvent:event];
//    
//    // update the image
////    if (self.drawingMode == DrawingModePainting){
////        [self updateCacheImage:NO];
////        
////        // clear the current tool
////        self.currentTool = nil;
////        
////        // clear the redo queue
////        [self.bufferArray removeAllObjects];
////        
////        if (self.drawingMode == DrawingModePainting){
////            TcpClient *tcp = [TcpClient sharedInstance];
////            dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
////                for(NSString *host in self.hostIdarr){
////                    [tcp writeString:[Common tcpDrawXYstring:[host intValue] Metuod:@"DeviceEndDraw" X:(currentLocation.x)*self.zoomX Y:(currentLocation.y)*self.zoomY]];
////                }
////            });
////        }
////        // call the delegate
////        if ([self.delegate respondsToSelector:@selector(drawingView:didEndDrawUsingTool:)]) {
////            [self.delegate drawingView:self didEndDrawUsingTool:self.currentTool];
////        }
////    }
//}
//
//- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
//{
//    // make sure a point is recorded
//    [self touchesEnded:touches withEvent:event];
//}
@end
